package com.whli.autumn.mall.wms.mapper;

import com.whli.autumn.core.extend.mapper.IBaseMapper;
import com.whli.autumn.mall.wms.domain.dto.stockdtl.StockDtlQueryDTO;
import com.whli.autumn.mall.wms.domain.entity.StockDtl;
import com.whli.autumn.mall.wms.domain.vo.stockdtl.StockDtlVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>库存明细数据操作</p>
 *
 * @author whli
 * @version 1.0.0
 * @since 2023-04-09 08:37
 */
@Mapper
public interface StockDtlMapper extends IBaseMapper<StockDtl> {

    /**
     * <p>查询指定仓库及商品的库存明细</p>
     *
     * @author whli
     * @since 2023/5/1 11:53
     * @param entity 参数
     * @return
     */
    List<StockDtlVO> findByWarehouseAndProduct(StockDtlQueryDTO entity);

    /**
     * <p>更改库存</p>
     *
     * @author whli
     * @since 2023/5/1 12:06
     * @param id       主键
     * @param stockQty 数量
     * @return
     */
    int changeStockQty(@Param("id") String id, @Param("stockQty") BigDecimal stockQty);

    /**
     * <p>更改占用库存</p>
     *
     * @author whli
     * @since 2023/5/1 12:12
     * @param id          主键
     * @param occupiedQty 占用数量
     * @return
     */
    int changeOccupiedQty(@Param("id") String id, @Param("occupiedQty") BigDecimal occupiedQty);

}
